//
// Created by Asus on 2025/5/31.
//

#include <cmath>
#include <iostream>
#include <bits/ostream.tcc>
using namespace std;

void demo01() {
    cout << "short类型内存所占空间：" << sizeof(short) << endl;
    cout << "int类型内存所占空间：" << sizeof(int) << endl;
    cout << "long类型内存所占空间：" << sizeof(long) << endl;
    cout << "long long类型内存所占空间：" << sizeof(long long) << endl;
}

void demo02() {
    float f1 = 3.14f;
    double d1 = 3.14;
    cout << "f1:" << f1 << " d1:" << d1 << endl;
    cout << "float size:" << sizeof(float) << endl;
    cout << "double size:" << sizeof(double) << endl;
}

void demo03() {
    float f2 = 3e2; //3*10^2
    int i = 4e2;
    cout << "f2:" << f2 << endl;
    cout << "i:" << i << endl;
    float f3 = 2e-1;
    cout << "f3:" << f3 << endl;
}

void demo04() {
    char c1 = 'a';
    cout << "c1:" << c1 << endl;
    cout << "c1 size:" << sizeof(char) << endl;
    cout << short(c1) << endl;
    cout << (int)c1 << endl;
    cout << int(c1) << endl;
    char str[] = "hello";
    cout << "str:" << str << endl;
}

void demo05() {
    cout << "\\" << endl;
    cout << "\thello" << endl;
    cout << "\n" << endl;
}

void demo06() {
    // c风格
    char str1[] = "hello";
    cout << "str1:" << str1 << endl;

    string str2 = "hello";
    cout << "str2:" << str2 << endl;
}

void demo07() {
    bool flag = true;
    cout << "bool:" << flag << endl;

        bool flag2 = false;
    cout << "bool2:" << flag2 << endl;
    cout << "bool size:" << sizeof(bool) << endl;
}

void demo08() {
    //整型输入
    int a = 0;
    cout << "请输入整型变量：" << endl;
    cin >> a;
    cout << a << endl;

    //浮点型输入
    double d = 0;
    cout << "请输入浮点型变量：" << endl;
    cin >> d;
    cout << d << endl;

    //字符型输入
    char ch = 0;
    cout << "请输入字符型变量：" << endl;
    cin >> ch;
    cout << ch << endl;

    //字符串型输入
    string str;
    cout << "请输入字符串型变量：" << endl;
    cin >> str;
    cout << str << endl;

    //布尔类型输入
    bool flag = true;
    cout << "请输入布尔型变量：" << endl;
    cin >> flag;
    cout << flag << endl;
}

#define EXIT_SUCCESS 0

int main(char *argv[]) {
    // demo01();
    // demo02();
    // demo03();
    // demo04();
    // demo05();
    // demo06();
    // demo07();
    demo08();
    return EXIT_SUCCESS;
}
